<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.1/vue.min.js"></script>
    <script src="https://unpkg.com/showdown/dist/showdown.min.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/element-ui/2.15.14/index.min.js"></script>
    <script>
        window.onload = () => {
            new Vue({
                el: "#app",
                data: {
                    text: "",
                    html: "",
                },
                methods: {
                    textChange(){
                        var converter = new showdown.Converter();
                        this.html = converter.makeHtml(this.text);
                    }
                }
            })
        }
    </script>
</head>
<body>
    <div id="app">
        <el-input type="textarea" :rows="10" placeholder="请输入内容" v-model="text" @change="textChange"></el-input>

        <el-card class="box-card">
            <div v-html="html"></div>
        </el-card>
    </div>
</body>
</html>